namespace Tracker.WCF.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Address",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Address1 = c.String(),
                        Address2 = c.String(),
                        City = c.String(),
                        State = c.String(),
                        Zip = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Position",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Latitude = c.Double(nullable: false),
                        Longitude = c.Double(nullable: false),
                        InsertDate = c.DateTime(nullable: false),
                        User_ID = c.Int(nullable: false),
                        Address_ID = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.User", t => t.User_ID, cascadeDelete: true)
                .ForeignKey("dbo.Address", t => t.Address_ID, cascadeDelete: true)
                .Index(t => t.User_ID)
                .Index(t => t.Address_ID);
            
            CreateTable(
                "dbo.User",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Username = c.String(),
                        Email = c.String(),
                        Password = c.String(),
                        Salt = c.String(),
                        InsertDate = c.DateTime(nullable: false),
                        ModifiedDate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Position", new[] { "Address_ID" });
            DropIndex("dbo.Position", new[] { "User_ID" });
            DropForeignKey("dbo.Position", "Address_ID", "dbo.Address");
            DropForeignKey("dbo.Position", "User_ID", "dbo.User");
            DropTable("dbo.User");
            DropTable("dbo.Position");
            DropTable("dbo.Address");
        }
    }
}
